﻿using System;
using System.Drawing;
using System.Xml.Linq;
using System.Windows.Forms;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Collections.ObjectModel;

namespace CustomControls
{
   public interface IItemView
   {
      int Height
      {
         get;
         set;
      }
      string Caption
      {
         get;
         set;
      }
      string GroupId
      {
         get;
      }
      bool AllowDrag
      {
         get;
         set;
      }
      bool AllowMove
      {
         get;
         set;
      }
      bool AllowClone
      {
         get;
         set;
      }
      bool AllowRemove
      {
         get;
         set;
      }
      bool AllowDelete
      {
         get;
         set;
      }
      int HeaderHeight
      {
         get;
         set;
      }
      bool ShowSplitters
      {
         get;
         set;
      }
      Color CaptionColor
      {
         get;
         set;
      }
      Color ViewBackColor
      {
         get;
         set;
      }
      bool ShowCheckBoxes
      {
         get;
         set;
      }
      Control ViewControl
      {
         get;
      }
      ViewStyle ViewStyle
      {
         get;
         set;
      }
      Color HeaderBackColor
      {
         get;
         set;
      }
      DataItem SelectedItem
      {
         get;
         set;
      }
      Image HeaderBackground
      {
         get;
         set;
      }
      bool ShowFocusRectangle
      {
         get;
         set;
      }
      DataItem this[string name]
      {
         get;
      }
      Collection<DataItem> Items
      {
         get;
      }
      Collection<DataItem> AllItems
      {
         get;
      }
      StringCollection AllowedDropTags
      {
         get;
      }
      StringCollection AllowedDropTypes
      {
         get;
      }
      NodeSelectionType NodeSelectionType
      {
         get;
         set;
      }
      SortedList<string, Image> SmallImageList
      {
         get;
         set;
      }
      SortedList<string, Image> LargeImageList
      {
         get;
         set;
      }

      event MouseEventHandler HeaderMouseClick;
      event EventHandler<PaintEventArgs> HeaderPaint;
      event EventHandler<ItemViewBasicEventArgs> ItemHover;
      event EventHandler<ItemViewBasicEventArgs> ItemAdded;
      event EventHandler<ItemViewMovedEventArgs> ItemMoved;
      event EventHandler<ItemViewCancelEventArgs> ItemAdding;
      event EventHandler<ItemViewMovingEventArgs> ItemMoving;
      event EventHandler<ItemViewBasicEventArgs> ItemRemoved;
      event EventHandler<ItemsCompareEventArgs> ItemsCompare;
      event EventHandler<ItemViewBasicEventArgs> ItemSelected;
      event EventHandler<ItemViewBasicEventArgs> ItemActivated;
      event EventHandler<ItemViewBasicEventArgs> ItemDeselected;
      event EventHandler<ItemViewBasicEventArgs> ItemContextMenu;
      event EventHandler<ItemViewRemovingEventArgs> ItemRemoving;
      event EventHandler<ItemViewDragDropEventArgs> ItemDragging;
      event EventHandler<ItemViewDragDropEventArgs> ItemDropping;
      event EventHandler<ItemViewXmlAssignEventArgs> XmlAssign;
      event EventHandler<ItemViewXmlRetrieveEventArgs> XmlRetrieve;
      event EventHandler<ItemViewExpandedCollapsedEventArgs> ItemExpanded;
      event EventHandler<ItemViewExpandedCollapsedEventArgs> ItemCollapsed;

      void Sort();
      void Clear();
      void ShowView();
      void HideView();
      XElement GetXStructure();
      void RemoveItem(DataItem item);
      void CopyFrom(IItemView source);
      void StopFlashItem(DataItem item);
      void Expand(IEnumerable<string> names);
      void Collapse(IEnumerable<string> names);
      bool SetXStructure(XElement xml, object state);
      DataItem AddItem(DataItem item, DataItem parent);
      void AddHeaderButton(Image image, EventHandler click, bool right);
      void RemoveItem(DataItem item, bool withChildren, DataItem newParent);
      void MoveItem(DataItem item, DataItem parent, DropResults dropResult);
      void FlashItem(DataItem item, string image1, string image2, int period);
      DataItem CopyItem(DataItem source, DataItem parent, DropResults dropResult);
      DataItem AddItem(string name, string parent, string caption, string text, string image, object data);
      DataItem AddGroup(string name, string parent, string caption, string text, string image, object data);
      DataItem AddItem(string name, DataItem parent, string caption, string text, string image, object data);
      DataItem AddGroup(string name, DataItem parent, string caption, string text, string image, object data);
   }

   public interface IItemViewSet
   {
      Color ViewsBackColor
      {
         get;
         set;
      }
      Color FlatBorderColor
      {
         get;
         set;
      }
      Color HeadersForeColor
      {
         get;
         set;
      }
      Color HeadersBackColor
      {
         get;
         set;
      }
      Image HeadersBackground
      {
         get;
         set;
      }

      int HeadersHeight
      {
         get;
         set;
      }
      int AllBorderWidth
      {
         get;
         set;
      }
      int TopBorderWidth
      {
         get;
         set;
      }
      int LeftBorderWidth
      {
         get;
         set;
      }
      int RightBorderWidth
      {
         get;
         set;
      }
      int BottomBorderWidth
      {
         get;
         set;
      }

      ItemView this[string name]
      {
         get;
      }
      DataItem this[string viewEntry, string itemName]
      {
         get;
      }

      ItemView SelectEntry(string group, string name);
      ItemView AddItemView(string name, string caption, string group, ViewStyle style);
      DataItem AddItem(string viewEntry, string itemName, DataItem parent, string caption, string text, string image, object data);
      DataItem AddGroup(string viewEntry, string groupName, DataItem parent, string caption, string text, string image, object data, DataItem[] childs);
      DataItem AddItem(string viewEntry, string itemName, string parentName, string caption, string text, string image, object data);
      DataItem AddGroup(string viewEntry, string groupName, string parentName, string caption, string text, string image, object data, DataItem[] childs);
   }
}
